package com.cuckoo.mall.thus.order.orderlist.paidorder;

import com.bgn.baseframe.base.BasePresenterImpl;
import com.bgn.baseframe.network.HttpObserver;
import com.bgn.baseframe.network.bean.TDataBean;
import com.cuckoo.mall.javabean.Order;
import com.cuckoo.mall.network.ApiManager;

import java.util.List;


/** * 作者：wl on 2018/4/ * 邮箱：wanglun@stosz.com */

public class PaidorderPresenter extends BasePresenterImpl<PaidyorderContract.View> implements PaidyorderContract.Presenter {

    @Override
    public void loadOrderList(final int loadType, String is_pay, int page_index, int page_count) {
        ApiManager.loadOrderList(is_pay, page_index, page_count).subscribe(new HttpObserver<TDataBean<List<Order>>>(mView) {
            @Override
            public void onSucceed(TDataBean<List<Order>> value) {
                mView.whenGetOrderList(loadType, value.getData());
            }
        });


    }

    @Override
    public void deleteOrder(final int position, String order_num) {
        ApiManager.deleteOrder(order_num).subscribe(new HttpObserver<TDataBean>(mView) {
            @Override
            public void onSucceed(TDataBean value) {
                mView.deleteSucceed(position);
            }
        });
    }
}
